cmake_minimum_required(VERSION 3.15)

project(BciScreenController)

# QT env configuration
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(QT NAMES Qt5 COMPONENTS 
    Core 
    Widgets
    Network
    SerialPort
    REQUIRED
)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS 
    Core 
    Widgets
    Network
    SerialPort
    REQUIRED
)

#file(GLOB HEADERS "include/*.h")

add_library(BciScreenController STATIC
    src/qbciscreencontrollershell.cpp
    include/qbciscreencontrollershell.h
    include/QBciScreenControllerShell
    src/qbciscreencontroller.cpp
    include/qbciscreencontroller.h
    include/QBciScreenController
    src/qbciserial.cpp
    include/qbciserial.h
    include/QBciSerial
    src/qbciscreencontrollershell.cpp
    include/qbciscreencontrollershell.h
    include/QBciScreenControllerShell
    src/qbciscreencontroller.cpp
    include/qbciscreencontroller.h
    include/QBciScreenController

)

add_library(utils::BciScreenController ALIAS BciScreenController)

target_include_directories(${PROJECT_NAME}
    PUBLIC
    ${PROJECT_SOURCE_DIR}/include
    Qt${QT_VERSION_MAJOR}::Core
    Qt${QT_VERSION_MAJOR}::Widgets
    Qt${QT_VERSION_MAJOR}::Network
    utils::QLogger
)

target_link_libraries(${PROJECT_NAME}
    PUBLIC
        Qt${QT_VERSION_MAJOR}::Core
        Qt${QT_VERSION_MAJOR}::Widgets
        Qt${QT_VERSION_MAJOR}::Network
        Qt${QT_VERSION_MAJOR}::SerialPort
        utils::QLogger
)

add_subdirectory(demo/BciScreenControllerDemo)
